<!--
This file is a demo of the Dojo + jabsorb

You must have jabsorb installed in order for this to run.
This assumes that jabsorb is at /jabsorb-1.3/, but you
can change the target if it as a different location.

This uses the Hello example from the jabsorb framework (Hello.java and hello.jsp)
-->
<html>
<head>
	<title>Demo of Dojo + jabsorb</title>
	<style type="text/css">

		@import "../../../dijit/themes/tundra/tundra.css";
		@import "../../../dojo/resources/dojo.css";
	</style>

	<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true"></script>
	<script type="text/javascript">
		dojo.require("dojox.rpc.Service");
		dojo.require("dojox.rpc.JsonRPC");
		var services = new dojox.rpc.Service({
			target:"/jabsorb-1.3/JSON-RPC",
			transport:"POST",
			envelope:"JSON-RPC-1.0",
			contentType:"application/json",
			services:{
				"hello.sayHello":{
					returns:{"type":"string"},
					parameters:[{"type":"string"}]
				}
			}
		});
		function clickHello() {
			var whoInput = document.getElementById("who");
			var deferred = services["hello.sayHello"](whoInput.value);
			deferred.addCallback(function(result) {
				alert(result);
				return result;
			})
		}

	</script>
</head>

<body class="tundra">
	<h1>
		DEMO:  jabsorb
	</h1>
	<hr>
	<h3>
		Description:
	</h3>
	<p>
		This simple demo shows how to connect to a <a href="http://jabsorb.org/">jabsorb server</a>
	</p>
<p>The jabsorb <em>Hello World</em> application.</p>

<p>
  <strong>Who:</strong>
  <input type="text" id="who" size="30" value="Michael"/>
  &nbsp;

  <input type="button" value="Say Hello" onclick="clickHello()"/>
</p>
<body>
	<hr/>
</body>
</html>
